<?php
/**
 * This file is part from Ewuroweb Shop
 *
 * @package 
 * @author Ivan I. Atanasov <i.atanasov@viscomp.bg>
 */

require_once dirname(__FILE__).'/VisSelenium.php';

class VisSeleniumSession {
    
    /**
     * Selenium Command Dispatcher
     * 
     * @var VisSelenium
     * @access private
     */
    private static $_selenium = NULL;
    
    static function GetSelenium() {
        if(!self::$_selenium) {
            throw new Exception('VisSeleniumSession class was not initialized properly.');
        }
        return self::$_selenium;
    }
    //===============================================================================================================
    
    function __construct($browser, $browserUrl, $host = 'localhost', $port = 4444, $timeout = 30000) {
        //self::$_selenium = new Testing_Selenium("*firefox /usr/lib/firefox-3.0.15/firefox", "http://ewshop.fb");
        self::$_selenium = new VisSelenium($browser, $browserUrl, $host = 'localhost', $port = 4444, $timeout = 30000);
        $sessionId = self::$_selenium->start();
    }
    //===============================================================================================================
    
    function __destruct() {
        self::$_selenium->stop();
    }
    //===============================================================================================================
    
    function setTimeout($iTimeout) {
        $this->_selenium->setTimeout($iTimeout);
    }
    //===============================================================================================================
    
}